﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Common;

namespace ZhccPua
{
    public partial class ClientRegForm : Form
    {
        public ClientRegForm()
        {
            InitializeComponent();

            tbMCode.Text = Utility.MachineCodeMD5;
        }

        private void btReg_Click(object sender, EventArgs e)
        {
            bool isok = false;
            Security.DecryptDES(tbCode.Text, tbKey.Text, out isok);

            if (isok)
            {
                WriteRegInfomation();
            }
        }

        private void WriteRegInfomation()
        {
            /*
             RegCOC.coc
             * Code+&Wack&+Key   = Base64
             * 
             */

            Utility.WriteFile("RegCOC.coc", new Base64Encoder().GetEncoded(String.Format("{0}$Wack${1}", tbCode.Text, tbKey.Text)));
        }
    }
}
